home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 48 / Amiga Format CD48 (1999-12-13)(Future Publishing)(GB)(Track 1 of 2)[!][issue 2000-01].iso / -serious- / programming / mui / mcc_popph / developer / autodocs / mcc_popplaceholder.doc
Text File  |  1999-11-08  |  17KB  |  503 lines

  1. TABLE OF CONTENTS
  2.  
  3. Popplaceholder.mcc/Popplaceholder.mcc
  4. Popplaceholder.mcc/MUIA_Popph_Array
  5. Popplaceholder.mcc/MUIA_Popph_Avoid
  6. Popplaceholder.mcc/MUIA_Popph_Contents
  7. Popplaceholder.mcc/MUIA_Popph_CopyEntries
  8. Popplaceholder.mcc/MUIA_Popph_InsertMode
  9. Popplaceholder.mcc/MUIA_Popph_PopAsl
  10. Popplaceholder.mcc/MUIA_Popph_PopbuttonKey
  11. Popplaceholder.mcc/MUIA_Popph_PopCycleChain
  12. Popplaceholder.mcc/MUIA_Popph_ReplaceMode
  13. Popplaceholder.mcc/MUIA_Popph_Separator
  14. Popplaceholder.mcc/MUIA_Popph_SingleColumn
  15. Popplaceholder.mcc/MUIA_Popph_StringKey
  16. Popplaceholder.mcc/MUIA_Popph_StringMaxLen
  17. Popplaceholder.mcc/MUIA_Popph_StringType
  18. Popplaceholder.mcc/MUIA_Popph_Title
  19.  
  20. Popplaceholder.mcc/Popplaceholder.mcc
  21.  
  22.   Popplaceholder class is a simple but useful class ;) Most applications
  23.   are fully configurable nowadays, offering wide range of various
  24.   parameters for further user modifications.  Not only functions options
  25.   or forms of behaviour are configurable but often most of program
  26.   strings can now be changed by the user.  The latter applies to
  27.   internet (communication) related programs mostly, (e.g.  AmIRC,
  28.   AmTelnet, YAM and so on...) which needs to send various string to
  29.   other different people.  So they allow you to define e.g.  own welcome
  30.   phrase or kick reason sentence.  Because e.g.  your welcome phrase for
  31.   e.g.  John and phrase for Mary will differ only with the name, most of
  32.   these strings uses so called placeholders, to describe varable,
  33.   dynamically modified string part (e.g.  mentioned receipient name).
  34.   For example "On %d, %u wrote:".  The "%d" and "%u" ares just the
  35.   placeholders, program will replace on use by for instance mail date
  36.   and the sender's name (of course placeholder can look like "@name" or
  37.   "%{date}", but the idea behind remains).
  38.  
  39.   Unfortunately, most programs forces user to know what placeholder can
  40.   be user where and which means what.  That's kinda user unfriendly
  41.   (especially for beginners, or just-users).  Instead of forcing them to
  42.   type placeholders by hand (in proper syntax!) it would be nicer to let
  43.   them pick up what they want from the list of available items.  That
  44.   both eliminates placeholder syntax problems (unless user 'fix' it
  45.   later by hand of course) as well as disallows to use unsupported
  46.   placeholder (the above exception applies of course).  And here comes
  47.   Popplaceholder class.  It features the ordinary string gadget user can
  48.   type own text in, but it also gives the popup listview, which holds
  49.   all available placeholders.  User can easily select one from the list
  50.   either by double click or by neat drag&drop.  See the example demo
  51.   program for better picture.
  52.  
  53.  
  54.   Popplaceholder is freeware software, but it's copyrighted
  55.   © 1999 by Marcin Orlowski <carlos@amiga.com.pl>
  56.  
  57.   PS: Yes, I know my english sucks ;)
  58.  
  59.   $Id: mcc_popplaceholder.doc,v 1.1 1999/10/13 21:51:11 carlos Exp $
  60.  
  61. Popplaceholder.mcc/MUIA_Popph_Array
  62.  
  63.     NAME
  64.         MUIA_Popph_Array -- [IS.], char **
  65.  
  66.     FUNCTION
  67.         A NULL terminated list of strings defining the contents
  68.         of the poplist object. The string format is as follow:
  69.  
  70.         "item|description"
  71.          ^   ^^
  72.          |   |+- the human understandable description of the tag
  73.          |   |
  74.          |   +-- separator
  75.          |
  76.          +------ the tag itself (anything you want)
  77.  
  78.  
  79.     NOTES
  80.         Please note the items are INSERTED into the list. They
  81.         do not replace existsing entries. If you want to reuse
  82.         the object w/o destroying it, you may clear the list
  83.         using MUIM_List_Clear method (note, most List object
  84.         related methods are directly forwarded to the Popph's
  85.         internal list object, so you can sort, insert single
  86.         entries, remove etc as you used to do with ordinary
  87.         List objects)
  88.  
  89.     LIMITATIONS
  90.         Recently the internal processing buffers are fixed
  91.         size and holds up to 50 chars for tag and 128 chars
  92.         for description. If you need bigger buffers, let me
  93.         know.
  94.  
  95.     EXAMPLE
  96.  
  97.     static const char *PP_Table[] =
  98.     {
  99.     "%s|normal",
  100.     "%g|highlight",
  101.     "\\n|LF",
  102.     "\\t|Tabulator",
  103.     "Tag|Description",
  104.     "WWW|World Wide Web",
  105.     NULL
  106.     };
  107.  
  108.     set(obj, MUIA_Popph_Array, PP_Table );
  109.  
  110.     SEE ALSO
  111.         MUIA_Popph_Separator, MUIA_Popph_CopyEntries
  112.         MUI_List.doc
  113.  
  114. Popplaceholder.mcc/MUIA_Popph_Avoid
  115.  
  116.     NAME
  117.         MUIA_Popph_Avoid  {I..} LONG
  118.  
  119.     FUNCTION
  120.         Popplaceholder transparently handles and utilises external
  121.         classes like string object replacements and list class
  122.         replacements. The fallback scheme looks:
  123.  
  124.           for string object: Textinput->Betterstring->String
  125.           for list object  : NList->List
  126.  
  127.         Using this attribute you can tell Popph you don't wish
  128.         the particular object to be used. The following are
  129.         recently supported:
  130.  
  131.         MUIV_Popph_Avoid_Betterstring 
  132.         MUIV_Popph_Avoid_Textinput
  133.         MUIV_Popph_Avoid_Nlist
  134.  
  135.         If you wish to avoid more than one class at the object
  136.         creation time, just OR (do not add them!) the
  137.         MUIV_Popph_Avoid tags, or use MUIA_Popph_Avoid as many
  138.         times as you need (internally, Popph just ORs the arguments
  139.         with internal mask)
  140.  
  141.         NOTE: I stronly recommend to avoid using this attribute,
  142.               unless you *really* have to (if you think so, sit
  143.               down an rethink it once again). The forthcomming
  144.               preference module (#?.mcp) will let user decide
  145.               which classes hi/she likes or dislikes.
  146.  
  147.     EXAMPLE
  148.  
  149.     PopphObject, MUIA_Popph_Avoid, MUIV_Popph_Avoid_Betterstring,
  150.                  MUIA_Popph_Avoid, MUIV_Popph_Avoid_Nlist,
  151.                  End,
  152.  
  153.         or (means exactly the same):
  154.  
  155.     PopphObject, MUIA_Popph_Avoid, ( MUIV_Popph_Avoid_Betterstring |
  156.                                     MUIV_Popph_Avoid_Nlist ),
  157.                  End,
  158.  
  159.     SEE ALSO
  160.  
  161. Popplaceholder.mcc/MUIA_Popph_Contents
  162.  
  163.     NAME
  164.         MUIA_Popph_Contents -- [ISG], char *
  165.  
  166.     FUNCTION
  167.         This attribute gives you direct access to the internal string
  168.         object. By setting it, you change the string gadget contents,
  169.         by getting it, you can get what user crested. It simply acts
  170.         as String/MUIA_String_Contents.
  171.  
  172.     NOTES
  173.         Popplaceholder transparently handles most popular string object
  174.         replacements as Textinput.mcc and Betterstring.mcc.  However class
  175.         understands some tags of these classes, you should NOT use anything
  176.         else than MUIA_Popph_Contents to access Popph's string. This
  177.         will prevent you from further problems.
  178.         
  179.  
  180.     EXAMPLE
  181.  
  182.     char *buf;
  183.  
  184.     get( obj, MUIA_Popph_Contents, &buf );
  185.  
  186. Popplaceholder.mcc/MUIA_Popph_CopyEntries
  187.  
  188.     NAME
  189.         MUIA_Popph_CopyEntries  {ISG} BOOL
  190.  
  191.     FUNCTION
  192.         However you can talk to Popph object as to ordinary List object
  193.         to access its internal object list (most List's methods are
  194.         forwarded), not all things can be done that way. By default,
  195.         Popph does NOT buffer list entries (no hooks are used), so the
  196.         all inserted strings should remains available while the objects
  197.         uses them. But it might be somethimes useful to order Popph to 
  198.         take care of the strings by itself. By setting this attribute
  199.         to TRUE, all *further* added/inserted entries are copied and buffered
  200.         internally and you may stop worry about them (Popph will set built-in
  201.         string hooks for list then).  Existsing entries, WON'T get buffered
  202.         unless you remove and reinsert them! Memory will automaticaly
  203.         get fried when you destroy the object (or clear the list with
  204.         MUIM_List_Clear)
  205.  
  206.     DEFAULT VALUE
  207.         FALSE (no buffering)        
  208.  
  209.     BUGS
  210.         Rather side-effect than bug, but:
  211.  
  212.         when you set MUIA_Popph_CopyEntries to TRUE, insert some entries
  213.         and then set it back to FALSE, no memory will be fried on list
  214.         clear or object disposition. 
  215.  
  216.         It's advised to not play with this attribute heavily. Just set
  217.         it TRUE on object creation if you need buffering and forget ;)
  218.  
  219.  
  220.     SEE ALSO
  221.         MUIA_Popph_Array,
  222.         MUIM_List_Clear, MUIA_List_ContructHook, MUIA_List_DestructHook,
  223.         MUI_List.Doc
  224.  
  225. Popplaceholder.mcc/MUIA_Popph_InsertMode
  226.  
  227.     NAME
  228.         MUIA_Popph_InsertMode  {ISG} ULONG
  229.  
  230.     FUNCTION
  231.         By default, Popph inserts the placeholder at the current
  232.         cursor position. Hovever, for some reasons, you may wish
  233.         to change that behaviour (separately for D&D and DC (double
  234.         click) actions). Available options are:
  235.  
  236.         MUIV_Popph_InsertMode_Default - depends on user settings
  237.                                         or at the cursor position
  238.                                         if no user prefs is set
  239.                                         (both D&D and DC) 
  240.  
  241.         MUIV_Popph_InsertMode_CursorPos - forces putting placeholders
  242.                                         at current cursor position
  243.  
  244.         MUIV_Popph_InsertMode_Apend   - always apends placeholder
  245.                                         at the end of the current
  246.                                         string (both D&D, DC)
  247.         MUIV_Popph_InsertMode_Prepend - always inserts placeholder
  248.                                         at the beginning of the
  249.                                         string (both D&D and DC)
  250.  
  251.         MUIV_Popph_InsertMode_DD_Default
  252.         MUIV_Popph_InsertMode_DD_Apend
  253.         MUIV_Popph_InsertMode_DD_Prepend
  254.         MUIV_Popph_InsertMode_DC_Default
  255.         MUIV_Popph_InsertMode_DC_Apend
  256.         MUIV_Popph_InsertMode_DC_Prepend
  257.                                       - same as above but applies
  258.                                         to D&D or DC separately.
  259.                                         See the include file to
  260.                                         find out how the global (for
  261.                                         both actions) special value
  262.                                         is defined.
  263.  
  264.         If you want set different actions for DD and DC either OR
  265.         the MUIV_... values, or use MUIA_Popph_InsertMode as many
  266.         times as you wish (internally Popph ORs the argument with
  267.         internal mask)
  268.                                         
  269.         
  270.  
  271.     DEFAULT VALUE
  272.         MUIV_Popph_InsertMode_Default
  273.  
  274.     BUGS
  275.  
  276.     SEE ALSO
  277.         MUIA_Popph_Array,
  278.         MUIM_List_Clear, MUIA_List_ContructHook, MUIA_List_DestructHook,
  279.         MUI_List.Doc
  280.  
  281. Popplaceholder.mcc/MUIA_Popph_PopbuttonKey
  282.  
  283.     NAME
  284.         MUIA_Popph_PopbuttonKey {IS.} char 
  285.  
  286.     FUNCTION
  287.         Same as MUIA_ControlChar - sets the hotkey for internal popup
  288.         button object.
  289.  
  290.     DEFAULT VALUE
  291.         no hotkey
  292.  
  293.     SEE ALSO
  294.         MUIA_ControlChar
  295.  
  296. Popplaceholder.mcc/MUIA_Popph_PopAsl
  297.  
  298.     NAME
  299.         MUIA_Popph_PopAsl    {I..} BOOL
  300.  
  301.     FUNCTION
  302.         Since version 14.5, Popph features PopAsl alike mode, allowing
  303.         you to combine adventages of Popplaceholder class and Asl
  304.         requester.
  305.         
  306.     DEFAULT VALUE
  307.         FALSE
  308.  
  309.     BUGS
  310.         Not real bug though, but don't use MUIA_Popasl_StartHook and
  311.         MUIA_Popasl_StopHook.
  312.  
  313.     SEE ALSO
  314.         MUIA_Popph_AslActive, MUIA_Popph_AslType
  315.         MUIA_Popasl_Active, MUIA_Popasl_Type
  316.  
  317. Popplaceholder.mcc/MUIA_Popph_PopCycleChain
  318.  
  319.     NAME
  320.         MUIA_Popph_PopCycleChain    {ISG} BOOL
  321.  
  322.     FUNCTION
  323.         Since version 14.8, Popph lets you remove the popup button from the
  324.         cycle chain, as some developers seems to don't like all objects
  325.         to be cyclechained by default.
  326.  
  327.     DEFAULT VALUE
  328.         TRUE
  329.  
  330.     BUGS
  331.         When in ASL mode, this attribute affects popasl button as well.
  332.         This is not a bug, but while there should be rather separate
  333.         attribute, this info remain in this section unless someone's
  334.         add it or will nag too much ;-)
  335.  
  336.     SEE ALSO
  337.         MUIA_CycleChain
  338.  
  339. Popplaceholder.mcc/MUIA_Popph_ReplaceMode
  340.  
  341.     NAME
  342.         MUIA_Popph_ReplaceMode    {ISG} BOOL
  343.  
  344.     FUNCTION
  345.         By default, whenever you double click or Drag&Drop any placeholder
  346.         from the popup list, it will be inserted/appended to the current
  347.         contents of string gadget. If you set this attribute to TRUE,
  348.         old contents of the string gadget will be replaced by the new
  349.         placeholder
  350.  
  351.     DEFAULT VALUE
  352.         FALSE
  353.  
  354.     SEE ALSO
  355.  
  356. Popplaceholder.mcc/MUIA_Popph_Separator
  357.  
  358.     NAME
  359.         MUIA_Popph_Separator    {ISG} char 
  360.  
  361.     FUNCTION
  362.         If you need to alter the separator (because you use default
  363.         one for other purposes) specify it here.
  364.  
  365.     BUGS:
  366.         Not a bug honestly, but keep in mind that you should NOT
  367.         change the separator character if there are still some entries
  368.         that use the old one. Change will break the parsing and handling
  369.         of the  'old' entries. To be safe, either set up your own separator
  370.         once on startup, or clear/reset placeholder array on evey change.              
  371.  
  372.     DEFAULT VALUE
  373.         |  (dec. code 124)
  374.  
  375.     SEE ALSO
  376.         MUIA_Popph_Array
  377.  
  378. Popplaceholder.mcc/MUIA_Popph_StringKey
  379.  
  380.     NAME
  381.         MUIA_Popph_StringKey {IS.} char 
  382.  
  383.     FUNCTION
  384.         Same as MUIA_ControlChar - sets the hotkey for internal string
  385.         object.
  386.  
  387.     DEFAULT VALUE
  388.         no hotkey
  389.  
  390.     SEE ALSO
  391.         MUIA_ControlChar
  392.  
  393. Popplaceholder.mcc/MUIA_Popph_StringMaxLen
  394.  
  395.     NAME
  396.         MUIA_Popph_StringMaxLen  {I.G} LONG
  397.  
  398.     FUNCTION
  399.         Setup the maximum length for the string gadget.
  400.         This attribute is only valid at object creation time.
  401.  
  402.         NOTE:  The maximum length includes the 0-byte at the end
  403.                of the string. To let the user enter e.g. 10 characters,
  404.                you would have to specify a maxlen of 11.
  405.  
  406.         NOTE2: Default max lenght gets doubled when you use
  407.                MUIA_Popph_PopAsl attribute, to avoid path cut-offs.
  408.                
  409.  
  410.     DEFAULT VALUE
  411.         POPPH_MAX_STRING_LEN   (128 bytes) for ordinary object
  412.         POPPH_MAX_STRING_LEN*2 (256 bytes) for PopAsl alike
  413.  
  414.     SEE ALSO
  415.         MUIA_Popph_PopAsl, MUIA_String_MaxLen
  416.  
  417. Popplaceholder.mcc/MUIA_Popph_StringType
  418.  
  419.     NAME
  420.         MUIA_Popph_StringType  {..G} LONG
  421.  
  422.     FUNCTION
  423.         In case you wonder what type of string gadget Popph is recently
  424.         using, get this attribute, which should be equal to one of
  425.         the following:
  426.  
  427.         MUIV_Popph_StringType_String
  428.         MUIV_Popph_StringType_Betterstring 
  429.         MUIV_Popph_StringType_Textinput
  430.  
  431.         NOTE: However Popph forwards all Textinput/BetterString/String
  432.               class' related attributes to the internal string object
  433.               please avoid using them. Popph knows about differences
  434.               between these classes and properly uses them no matter
  435.               what string object is used without any crashes and other
  436.               neat sideeffects! You have been warned.
  437.  
  438.     SEE ALSO
  439.         MUIA_Popph_Avoid
  440.  
  441. Popplaceholder.mcc/MUIA_Popph_SingleColumn
  442.  
  443.     NAME
  444.         MUIA_Popph_SingleColumn {ISG} BOOL
  445.  
  446.     FUNCTION
  447.         Since v15 you can use Popplaceholder in single mode. This is
  448.         very useful if you don't have any description for you placeholders
  449.         or want to use the class for other purposes than placeholders
  450.  
  451.     BUGS
  452.         Single mode or not, string length limits remains unchanged. This
  453.         means, POPPH_MAX_KEY_LEN is the limit for the 1st column.
  454.  
  455.     DEFAULT VALUE
  456.         FALSE (two columns)
  457.  
  458.     SEE ALSO
  459.         mcc_popplaceholder.h/POPPH_MAX_KEY_LEN
  460.  
  461. Popplaceholder.mcc/MUIA_Popph_Title
  462.  
  463.     NAME
  464.         MUIA_Popph_SingleColumn {IS.}  STRPTR  v15
  465.  
  466.     FUNCTION
  467.         Since v15 you can have custom title for popup list's columns.
  468.         Pass pointer to your title string or NULL if you want to
  469.         remove title (if was previously set). The title string will be
  470.         copied to internal buffer. You can use all MUI formating codes
  471.         like MUIX_B, MUIX_C or colors as well. To separate titles for
  472.         default two column mode use separator character.
  473.         
  474.         NOTE: If you defined custom separator character, your title
  475.               string have to use it otherwise it won't be properly
  476.               parsed (important for two column mode). The rule of thumb:
  477.               always use the separator that is the "current" at the
  478.               given moment.
  479.  
  480.     DEFAULT VALUE
  481.         NULL (no titles)
  482.  
  483.     EXAMPLE
  484.         MUIA_Popph_Title, "Key|Info"
  485.  
  486.         if you want to override separator:
  487.  
  488.         ...
  489.         MUIA_Popph_Separator, '$',
  490.         MUIA_Popph_Title    , "Title$Node",
  491.         ...
  492.  
  493.         but:
  494.  
  495.         ...
  496.         MUIA_Popph_Title    , "Title|Node",
  497.         MUIA_Popph_Separator, '$',
  498.         ...
  499.  
  500.     SEE ALSO
  501.         mui.h/MUIX_#?
  502.  
  503.